<script>
	import Fetch from "./Fetch.svelte";
	import Form from "./Form.svelte";
	let searchTerm;
	function handleSubmit() {
		const { value } = this.elements.search;
        searchTerm = value;
	}
</script>
<Form {handleSubmit} />
<Fetch {searchTerm} url="https://jsonplaceholder.typicode.com/todos" title="A list of todos" let:data let:title>
	<h1>{title}</h1>
	<ul>
		{#each data as link}
			<li>
				<a href="{link.url}">{link.title}</a>
			</li>
		{/each}
	</ul>
</Fetch>